package com.dlkw.easyroom.compiler;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IOUtils {
    public static long copy(InputStream is, OutputStream os) {
        try {
            byte[] buffer = new byte[1024];
            int count = 0;
            long total = 0;
            while ((count = is.read(buffer)) > 0) {
                os.write(buffer, 0, count);
                total += count;
            }
            return total;
        } catch (IOException e) {
            e.printStackTrace();
            return -1;
        }
    }
}
